package monster.flight.admin.action.xtgl.menu;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import monster.comm.action.BaseJsonAction;
import monster.comm.log.ILog;
import monster.comm.log.LogService;
import monster.comm.util.ReturnConstant;
import monster.flight.admin.manager.service.xtgl.MenuService;
/**
 * 
* 创建信息=============
* 类名: monster.flight.admin.action.xtgl.menu.MenuCheckAction
* 类作用描述: 后台菜单ajajx检测
* 创建人： 鲜虎 
* 创建时间： 2013-1-25 下午03:42:25
* 修改信息1=============
* 修改类型:     //1.修改bug 2.业务变化修改
* 修改描述: 
* 修改人：  
* 修改时间：
 */
public class MenuCheckAction extends BaseJsonAction {
	private static final long serialVersionUID = 1L;
	private static ILog log = LogService.getLog(MenuCheckAction.class);
	private MenuService menuService;
	private String old_men_code;
	private String men_code;
	public String keyUnique(){
		boolean validate=false;
		String isLogin = isLogin();//是否登录
		if(!"1".equals(isLogin)){
			returnVO.returnCode=ReturnConstant.IS_NOT_LOGIN;
    	}else{
    		try { 
    			  validate=menuService.vild_MenuCode(men_code,old_men_code);
    			  returnVO.validationReturn = "[\"men_code\","+validate+"]";
    		} catch (Exception e) {
    			returnVO.returnCode=ReturnConstant.IS_DEAL_FAIL;
        		returnVO.returnDesc=e.getMessage();
        		log.error(e.getMessage());
			}
    	}
		return SUCCESS;
	}
	public String checkForm(){
		boolean validate=false;
		String isLogin = isLogin();//是否登录
		if(!"1".equals(isLogin)){
			returnVO.returnCode=ReturnConstant.IS_NOT_LOGIN;
    	}else{
    		try { 
    			  HttpServletRequest req= ServletActionContext. getRequest();
    			  String old_men_code=req.getParameter("old_men_code");
    			  String men_code=req.getParameter("men_code");
    			  validate=menuService.vild_MenuCode(men_code,old_men_code);
    			  returnVO.validationReturn = "[[\"men_code\","+validate+",\"checkXt_code\"]]";
    		} catch (Exception e) {
    			returnVO.returnCode=ReturnConstant.IS_DEAL_FAIL;
        		returnVO.returnDesc=e.getMessage();
        		log.error(e.getMessage());
			}
    	}
		return SUCCESS;
	}
	public void setMenuService(MenuService menuService) {
		this.menuService = menuService;
	}
	public String getOld_men_code() {
		return old_men_code;
	}
	public void setOld_men_code(String old_men_code) {
		this.old_men_code = old_men_code;
	}
	public String getMen_code() {
		return men_code;
	}
	public void setMen_code(String men_code) {
		this.men_code = men_code;
	}
	
}